/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

import request from "/@/utils/request"

export function fetchList(query) {
  return request({
    url: '/om/omworder/page',
    method: 'get',
    params: query
  })
}
export function fetchListTodo(query) {
  //待办
  return request({
    url: '/om/omworder/getPage',
    method: 'get',
    params: query
  })
}
export function fetchListMine(query) {
  //我的发起
  return request({
    url: '/om/omworder/page',
    method: 'get',
    params: query
  })
}
export function fetchListHandle(query) {
  //经办
  return request({
    url: '/om/omworder/page?',
    method: 'get',
    params: query
  })
}
export function omwordercomplain(obj) {
  //投诉
  return request({
    url: '/om/omwordercomplain',
    method: 'post',
    data: obj
  })
}
export function omworderappraise(obj) {
  //评价
  return request({
    url: '/om/omworderappraise',
    method: 'post',
    data: obj
  })
}
export function addObj(obj) {
  return request({
    url: '/om/omworder',
    method: 'post',
    data: obj
  })
}

export function getObj(id) {
  return request({
    url: '/om/omworder/' + id,
    method: 'get'
  })
}

export function delObj(id) {
  return request({
    url: '/om/omworder/' + id,
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: '/om/omworder',
    method: 'put',
    data: obj
  })
}
export function fetchTree(query) {
  return request({
    url: '/om/omwslatemplate/page',
    method: 'get',
    params: query
  })
}

//查询设备
export function getAssets(query) {
  return request({
    url: '/bm/bamaassetsstandingbook/getStandingbookBy',
    method: 'get',
    params: query
  })
}

//通过型号查设备
export function getAssetsByNo(query) {
  return request({
    url: '/em/deviceinfo/getDeviceByType',
    method: 'get',
    params: query
  })
}

//获取部门
export function getDeptTree() {
  return request({
    url: '/admin/dept/tree',
    method: 'get'
  })
}

//获取人员
export function getUser(id) {
  return request({
    url: '/admin/user/userswithdept/' + id,
    method: 'get'
    // params: query
  })
}

//操作工单
export function operaOrder(obj) {
  return request({
    url: '/om/omworder/operate',
    method: 'post',
    data: obj
  })
}

//获取人员
export function getUserById(id) {
  return request({
    url: '/admin/user/' + id,
    method: 'get'
    // params: query
  })
}

//工单待办
export function getOrderCount(query) {
  return request({
    url: '/om/count/waitcount',
    method: 'get',
    params: query
  })
}

//批量删除
export function delObjAll(obj) {
  return request({
    url: '/om/omworder/removeByIds',
    method: 'delete',
    data: obj
  })
}

//获取名称
export function getOrderName(type) {
  return request({
    url: '/om/omworder/getCurrentOrderNameSeq/' + type,
    method: 'get'
  })
}
